package com.dmap.analysispoint.controller.background;

import com.dmap.analysispoint.service.OldDataManageService;
import com.dmap.base.constants.Constant;
import com.dmap.base.vo.BaseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * \* @author:zhouhao
 * \* Date:26/06/2018
 * \* Description:数据预处理
 * \*
 */
@Api(value = "未处理的老数据处理", description = "background/未处理的老数据处理")
@Controller
@RequestMapping(value = "/background/dmap-analysis-point-server/v2/")
public class OldDataManageController {

    @Resource
    private OldDataManageService oldDataManageService;

    @ResponseBody
    @ApiOperation(value = "处理数据看板预处理数据未处理的老数据",
                  notes = "1.传入所要查询的参数，参数为截止处理数据时间后一天的零点时间戳，单位秒\n" +
                          "2.返回处理记录条数")
    @RequestMapping(value = "oldDataManage", method = RequestMethod.GET)
    public BaseVo oldDataManage(@RequestParam Long time) {
        BaseVo baseVo = new BaseVo();
        if (time == null || time == 0) {
            baseVo.setCode(Constant.RESPONSE_PARAM_ERROR_CODE);
            baseVo.setMsg(Constant.RESPONSE_PARAM_ERROR_MSG);
        }
        int success = oldDataManageService.oldDataManage(time);
        baseVo.setData(success);
        return baseVo;
    }
}
